package com.gxa.meiye.portal.shop.shopRegister.service.impl;

import com.gxa.meiye.portal.shop.shopRegister.service.RegisterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;


/**
 * @Author cc
 * @PackageName meiye
 * @Package com.gxa.meiye.admin.shop.service.impl
 * @Date 2022/7/19 15:25
 * @Version 1.0
 */
@Slf4j
@Service
public class RegisterServiceImpl  implements RegisterService {
        @Autowired
        JavaMailSenderImpl mailSender;//注入JavaMailSenderImpl对象，这里需要注入对象

        @Override
        public void send(String email, String code) {
            SimpleMailMessage mailMessage = new SimpleMailMessage();//创建一个简单的邮件信息对象
            //设置邮件发送信息的内容
            mailMessage.setSubject("美业项目验证码");//标题
            mailMessage.setText("您的验证码为:" +code+ "验证码5分钟内有效,请勿泄露。");//内容
            mailMessage.setFrom("1662001405@qq.com");//内容为发送方的邮箱地址
            mailMessage.setTo(email);//内容为接收方邮箱地址
            mailSender.send(mailMessage);//发送邮件
    }



}
